Create a role when first starting up the PostgreSQL DB


-- Login as postgres and Create DB, User

docker exec -it postgres-driver psql -U postgres
CREATE DATABASE driver;
CREATE USER adrian WITH ENCRYPTED PASSWORD 'password'

-- Check the users

\du

-- Grant privileges of DB driver to user and check DBs

GRANT ALL PRIVILEGES ON DATABASE driver TO adrian;
\l

-- Get Into DB

\c driver

-- Grant privileges of Tables and Sequences In Schema public to user

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO adrian;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO adrian;

-- Grant create of DB and Schema public to user

GRANT CREATE ON DATABASE driver TO adrian;
GRANT CREATE ON SCHEMA public TO adrian;
#docker #postgres






你可能感興趣的文章

[ Nuxt.js 2.x 系列文章 ] Nuxt.js 目錄結構

[ Nuxt.js 2.x 系列文章 ] Nuxt.js 目錄結構

七天打造自己的 Google Map 應用入門 - Day05

七天打造自己的 Google Map 應用入門 - Day05

學會 HTML & CSS (關於 CSS 的部份)

學會 HTML & CSS (關於 CSS 的部份)






留言討論